Repository navigation
fix(slack): stream a workflow reply into the thread of a clicked button - #10016
Draft
mzxchandra wants to merge 1 commit into
Draft
mzxchandra wants to merge 1 commit into
mzxchandra wants to merge 1 commit into
Conversation
A Slack trigger on block_actions could not stream its run's reply. Streaming was limited to message and app_mention, and interaction payloads never set user_team_id, which a streamed reply in a channel needs as its recipient team. Allow block_actions as a streaming event and normalize the clicking user's own team (user.team_id, falling back to the installation team) into user_team_id. The reply streams into the clicked message's thread.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A custom-bot Slack trigger on
block_actions(button or select click) could not stream its run's reply back into Slack.Two gaps caused this:
SLACK_STREAM_RESPONSE_EVENTSonly allowedmessageandapp_mention, so ablock_actionstrigger with Enable agent session on was rejected ("Slack streaming is only supported for reply-capable trigger events"), and the editor hid the streaming fields for it.formatSlackInteractivenever setuser_team_id.resolveSlackReplyTargetrequires it for any non-DM channel, so even with streaming allowed, a click in a channel thread would fail with "Slack channel streaming requires the recipient team ID".This change:
block_actionstoSLACK_STREAM_RESPONSE_EVENTS. The reply streams into the clicked message's thread (message.thread_ts, or the message itself when it is top-level), addressed to the clicking user.user_team_idfrom the interacting user's own team (user.team_id), falling back to the installation team. It is only the streaming recipient team; routing still usesteam.idalone, as the route's Slack Connect note requires.Use case: an agent posts suggested follow-up buttons under its answer, and clicking one runs that follow-up with the same live, streamed agent session as a typed message.
view_submissionstays non-streaming, since a modal submit has no conversation to reply into.Type of Change
Testing
user_team_idfalls back to the installation team.block_actionsand still rejectsview_submission.block_actionspayload, normalized by the Slack handler, registers the stream session and sets the session status against the clicked message's thread for the clicking user and team.vitestontriggers/slackandlib/webhooks: 72 files, 637 tests passing.biome checkis clean on the changed files.Checklist
🤖 Generated with Claude Code